import Vue from 'vue'
import Vuex from 'vuex'
import VuexPersistence from 'vuex-persist'

Vue.use(Vuex)
const store = () => new Vuex.Store({
  state: {
    userInfo: {
      addresses: null,
      avatar: "",
      carts: null,
      collections: null,
      createTime: "",
      email: "",
      id: 0,
      isActive: true,
      orders: null,
      password: "",
      phone: "",
      updateTime: "",
      username: ""
    },
    loginFlag: false, //是否登录
    menu: [], //商品分类
    collectionCount: 0, //收藏列表的数量
    cartCount: 0,  //购物车的数量
    routerActive: [],  //面包屑激活菜单

  },
  mutations: {
    setCollectionCount(state){
      state.collectionCount++
    },
    setCartCount(state){
      state.cartCount++
    },
  },
  actions: {
    //
  },
  modules: {}
})
export default store
